# -*- coding: utf8 -*-
'''
    1.3.7 pickle模块
'''

import pickle

immean = 'immean'
V = 2333

# 将前一节字体图像的平均值和主成分保存起来
f = open('font_pca_modes.pkl', 'wb')
pickle.dump(immean, f)
pickle.dump(V, f)
f.close()

# 载入数据
f = open('font_pca_modes.pkl', 'rb')
imean = pickle.load(f)
V = pickle.load(f)
print(imean)
print(V)
f.close()

# 使用with打开
with open('font_pca_modes.pkl', 'wb') as f:
    pickle.dump(immean, f)
    pickle.dump(V, f)
